﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.ProductManagement;

namespace Digitalmes.Model.FactoryManagement
{
    /// <summary>
    /// 产线
    /// </summary>
	[Table("ProductionLine")]

    [Display(Name = "_Model.ProductionLine")]
    public class ProductionLine : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._ProductionLine._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }


        [Display(Name = "_Model._ProductionLine._Code")]
        [StringLength(255, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("产线编码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Code { get; set; }
        [Display(Name = "_Model._ProductionLine._Name")]
        [StringLength(255, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("产线名称")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Name { get; set; }
        [Display(Name = "_Model._ProductionLine._Active")]
        [Comment("激活")]
        public bool Active { get; set; }=true;

        [Display(Name = "_Model._ProductionLine._PrincipalId")]
        [Comment("负责人")]
        [NotMapped]
        public FrameworkUser PrincipalId { get; set; }
        [Display(Name = "_Model._ProductionLine._PrincipalId")]
        [Comment("负责人")]
        public string PrincipalIdId { get; set; }
        [Display(Name = "_Model._ProductionLine._Aux_1")]
        [Comment("备用1")]
        public string Aux_1 { get; set; }
        [Display(Name = "_Model._ProductionLine._Aux_2")]
        [Comment("备用2")]
        public string Aux_2 { get; set; }
       
        //[Display(Name = "_Model._ProductionLine._Product")]
        //[Comment("产品")]
        //public long? ProductId { get; set; }

        //[Display(Name = "_Model._ProductionLine._Product")]
        //[Comment("产品")]
        //public Product Product { get; set; }


        [Display(Name = "_Model._ProductionLine._ProductName")]
        [Comment("产品名称")]
        public string ProductName { get; set; }
       
        [Display(Name = "_Model._ProductionLine._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }


        [InverseProperty("Line")]
        public List<LineShift> LineShift_Line { get; set; }



        [Display(Name = "_Model._ProductionLine._Equipment")]
        [Comment("关联设备")]
        public List<EquipmentProductionLine> EquipmentProductionLines { get; set; }

        [Display(Name = "_Model._ProductionLine._Product")]
        [Comment("生产产品")]
        public List<ProductProductionLine> ProductProductionLines { get; set; }
    }

}
